#ifndef MEMDATA_H
#define MEMDATA_H

#include <vector>
#include <map>
#include <string>
#include "database.h"
#include "article.h"
#include "newsgroup.h"
#include "newsgroupdoesnotexistexception.h"
#include "articledoesnotexistexception.h"

using namespace std;
 
namespace client_server{
	class Memdata: public Database{
	public:
		Memdata();
		~Memdata();

		//neccesary functions for newsgroups
		vector<pair<int, string> > listAllNewsGroups(); 
		void createNewsGroup(const string& name) throw (NewsGroupDoesNotExistException); 
		void deleteNewsGroup(unsigned int id) throw (NewsGroupDoesNotExistException);
		
		//functions for articles
		vector<pair<int,string> > listAllArticles(unsigned int id) throw (NewsGroupDoesNotExistException);
		void readArticle(unsigned int ngId, unsigned int aId, stringstream& ss) throw (NewsGroupDoesNotExistException, ArticleDoesNotExistException);
		void createArticle(unsigned int id,const string& content,const string& author=string("unknown"), const string& artName=string("article")) throw (NewsGroupDoesNotExistException);
		void deleteArticle(unsigned int ngId, unsigned int aId) throw (NewsGroupDoesNotExistException, ArticleDoesNotExistException);
		
	private:
		vector<NewsGroup*> ngs;
  };
}

#endif
